From: kaf24@scramble.cl.cam.ac.uk Date: Tue, 29 Jun 2004 20:25:15 +0000 (+0000) Subject: bitkeeper revision 1.1031 (40e1d02b7TWzZP0WaSOhCDygYQPX4w) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~18090 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=b887fccf309491e2a0d18bade23a392cdbaf5112;p=xen.git bitkeeper revision 1.1031 (40e1d02b7TWzZP0WaSOhCDygYQPX4w) Tool cleanups. --- diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index a45244fe00..88f1211183 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -1,4 +1,5 @@ *.a +*.d *.o *.pyc *.so @@ -17,29 +18,8 @@ linux-2.4.26-xen/* linux-xen-sparse patches/* tools/*/build/lib*/*.py -tools/balloon/balloon tools/misc/miniterm/miniterm tools/misc/xen_cpuperf -tools/misc/xen_log -tools/misc/xen_read_console -tools/xc/lib/.allocate.o.d -tools/xc/lib/.file_stream.o.d -tools/xc/lib/.gzip_stream.o.d -tools/xc/lib/.iostream.o.d -tools/xc/lib/.sys_net.o.d -tools/xc/lib/.sys_string.o.d -tools/xc/lib/.xc_atropos.o.d -tools/xc/lib/.xc_bvtsched.o.d -tools/xc/lib/.xc_domain.o.d -tools/xc/lib/.xc_evtchn.o.d -tools/xc/lib/.xc_io.o.d -tools/xc/lib/.xc_linux_build.o.d -tools/xc/lib/.xc_linux_restore.o.d -tools/xc/lib/.xc_linux_save.o.d -tools/xc/lib/.xc_misc.o.d -tools/xc/lib/.xc_netbsd_build.o.d -tools/xc/lib/.xc_physdev.o.d -tools/xc/lib/.xc_private.o.d tools/xentrace/xentrace xen/drivers/pci/classlist.h xen/drivers/pci/devlist.h @@ -52,23 +32,3 @@ xen/tools/figlet/figlet xen/xen xen/xen-syms xen/xen.* -tools/xc/lib/.xc_rrobin.o.d -tools/libxc/.xc_atropos.o.d -tools/libxc/.xc_bvtsched.o.d -tools/libxc/.xc_domain.o.d -tools/libxc/.xc_evtchn.o.d -tools/libxc/.xc_io.o.d -tools/libxc/.xc_linux_build.o.d -tools/libxc/.xc_linux_restore.o.d -tools/libxc/.xc_linux_save.o.d -tools/libxc/.xc_misc.o.d -tools/libxc/.xc_netbsd_build.o.d -tools/libxc/.xc_physdev.o.d -tools/libxc/.xc_private.o.d -tools/libxc/.xc_rrobin.o.d -tools/libxutil/.allocate.o.d -tools/libxutil/.file_stream.o.d -tools/libxutil/.gzip_stream.o.d -tools/libxutil/.iostream.o.d -tools/libxutil/.sys_net.o.d -tools/libxutil/.sys_string.o.d diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index 8db55c2028..bf81b86c6d 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -20,26 +20,6 @@ INCLUDES += -I $(XEN_XU) vpath %c $(XEN_LIBXUTIL) INCLUDES += -I $(XEN_LIBXUTIL) -LIB_SRCS := -LIB_SRCS += allocate.c -#LIB_SRCS += enum.c -LIB_SRCS += file_stream.c -LIB_SRCS += gzip_stream.c -#LIB_SRCS += hash_table.c -LIB_SRCS += iostream.c -#LIB_SRCS += kernel_stream.c -#LIB_SRCS += lexis.c -#LIB_SRCS += lzi_stream.c -#LIB_SRCS += lzo_stream.c -#LIB_SRCS += marshal.c -#LIB_SRCS += socket_stream.c -#LIB_SRCS += string_stream.c -#LIB_SRCS += sxpr.c -#LIB_SRCS += sxpr_parser.c -LIB_SRCS += sys_net.c -LIB_SRCS += sys_string.c -#LIB_SRCS += xdr.c - SRCS := SRCS += xc_atropos.c SRCS += xc_bvtsched.c @@ -55,11 +35,8 @@ SRCS += xc_physdev.c SRCS += xc_private.c SRCS += xc_rrobin.c -#SRCS += $(LIB_SRCS) - CFLAGS += -Wall CFLAGS += -Werror -CFLAGS += -g CFLAGS += -O3 CFLAGS += -fno-strict-aliasing CFLAGS += $(INCLUDES) @@ -106,10 +83,6 @@ libxc.so: libxc.so.$(MAJOR): ln -sf libxc.so.$(MAJOR).$(MINOR) $@ libxc.so.$(MAJOR).$(MINOR): $(OBJS) - $(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ ../libxutil/libxutil.a -lz - -%.o: %.c Makefile - -# $(CC) $(CFLAGS) -o $@ $< + $(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ -L../libxutil -lxutil -lz -include $(DEPS) diff --git a/tools/libxutil/Makefile b/tools/libxutil/Makefile index 0e92fa771f..9c59bc5be2 100644 --- a/tools/libxutil/Makefile +++ b/tools/libxutil/Makefile @@ -5,23 +5,11 @@ CC = gcc LIB_SRCS := LIB_SRCS += allocate.c -#LIB_SRCS += enum.c LIB_SRCS += file_stream.c LIB_SRCS += gzip_stream.c -#LIB_SRCS += hash_table.c LIB_SRCS += iostream.c -#LIB_SRCS += kernel_stream.c -#LIB_SRCS += lexis.c -#LIB_SRCS += lzi_stream.c -#LIB_SRCS += lzo_stream.c -#LIB_SRCS += marshal.c -#LIB_SRCS += socket_stream.c -#LIB_SRCS += string_stream.c -#LIB_SRCS += sxpr.c -#LIB_SRCS += sxpr_parser.c LIB_SRCS += sys_net.c LIB_SRCS += sys_string.c -#LIB_SRCS += xdr.c LIB_OBJS := $(LIB_SRCS:.c=.o) @@ -30,32 +18,28 @@ CFLAGS += -Werror CFLAGS += -g CFLAGS += -O3 CFLAGS += -fno-strict-aliasing -#CFLAGS += $(INCLUDES) + # Get gcc to generate the dependencies for us. CFLAGS += -Wp,-MD,.$(@F).d DEPS = .*.d -MAJOR = 1.3 -MINOR = 0 -LIB_NAME = libxutil -LIB_BASE = $(LIB_NAME).so -LIB_MAJOR= $(LIB_BASE).$(MAJOR) -LIB_MINOR= $(LIB_MAJOR).$(MINOR) -LIB = $(LIB_BASE) $(LIB_MAJOR) $(LIB_MINOR) $(LIB_NAME).a +MAJOR := 1.3 +MINOR := 0 +LIB_NAME := libxutil +LIB := $(LIB_NAME).so +LIB += $(LIB_NAME).so.$(MAJOR) +LIB += $(LIB_NAME).so.$(MAJOR).$(MINOR) all: check-for-zlib $(LIB) -$(LIB_BASE): - ln -sf $(LIB_MAJOR) $@ - -$(LIB_MAJOR): - ln -sf $(LIB_MINOR) $@ +$(LIB_NAME).so: + ln -sf $(LIB_NAME).so.$(MAJOR) $@ -$(LIB_MINOR): $(LIB_OBJS) - $(CC) -Wl,-soname -Wl,$(LIB_MAJOR) -shared -o $@ $^ +$(LIB_NAME).so.$(MAJOR): + ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $@ -$(LIB_NAME).a: $(LIB_OBJS) - $(AR) rc $@ $^ +$(LIB_NAME).so.$(MAJOR).$(MINOR): $(LIB_OBJS) + $(CC) -Wl,-soname -Wl,$(LIB_NAME).so.$(MAJOR) -shared -o $@ $^ check-for-zlib: @if [ ! -e /usr/include/zlib.h ]; then \ @@ -69,8 +53,7 @@ install: all mkdir -p $(prefix)/usr/lib mkdir -p $(prefix)/usr/include install -m0755 $(LIB) $(prefix)/usr/lib - -#install -m0644 xc.h $(prefix)/usr/include + install -m0644 xc.h $(prefix)/usr/include clean: $(RM) *.a *.so *.o *.rpm $(LIB) diff --git a/tools/python/setup.py b/tools/python/setup.py index b0eb3f2ebd..0b8efce0fd 100644 --- a/tools/python/setup.py +++ b/tools/python/setup.py @@ -3,7 +3,7 @@ from distutils.core import setup, Extension XEN_ROOT = "../.." -extra_compile_args = ["-fno-strict-aliasing"] +extra_compile_args = [ "-fno-strict-aliasing", "-Wall", "-Werror" ] include_dirs = [ XEN_ROOT + "/xen/include/hypervisor-ifs", diff --git a/tools/python/xen/ext/xc/xc.c b/tools/python/xen/ext/xc/xc.c index 2eb70cf2a0..ab045199e6 100644 --- a/tools/python/xen/ext/xc/xc.c +++ b/tools/python/xen/ext/xc/xc.c @@ -191,32 +191,42 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, return list; } -static int file_save(XcObject *xc, XcIOContext *ctxt, char *state_file){ +static int file_save(XcObject *xc, XcIOContext *ctxt, char *state_file) +{ int rc = -1; int fd = -1; int open_flags = (O_CREAT | O_EXCL | O_WRONLY); int open_mode = 0644; printf("%s>\n", __FUNCTION__); - fd = open(state_file, open_flags, open_mode); - if(fd < 0){ + + if ( (fd = open(state_file, open_flags, open_mode)) < 0 ) + { xcio_perror(ctxt, "Could not open file for writing"); goto exit; } + + printf("%s>gzip_stream_fdopen... \n", __FUNCTION__); + /* Compression rate 1: we want speed over compression. * We're mainly going for those zero pages, after all. */ - printf("%s>gzip_stream_fdopen... \n", __FUNCTION__); ctxt->io = gzip_stream_fdopen(fd, "wb1"); - if(!ctxt->io){ + if ( ctxt->io == NULL ) + { xcio_perror(ctxt, "Could not allocate compression state"); goto exit; } + printf("%s> xc_linux_save...\n", __FUNCTION__); + rc = xc_linux_save(xc->xc_handle, ctxt); + exit: - if(ctxt->io) IOStream_close(ctxt->io); - if(fd >= 0) close(fd); + if ( ctxt->io != NULL ) + IOStream_close(ctxt->io); + if ( fd >= 0 ) + close(fd); unlink(state_file); printf("%s> rc=%d\n", __FUNCTION__, rc); return rc; @@ -228,53 +238,62 @@ static PyObject *pyxc_linux_save(PyObject *self, { XcObject *xc = (XcObject *)self; - u32 dom; char *state_file; int progress = 1, debug = 0; - unsigned int flags = 0; PyObject *val = NULL; int rc = -1; XcIOContext ioctxt = { .info = iostdout, .err = iostderr }; static char *kwd_list[] = { "dom", "state_file", "vmconfig", "progress", "debug", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "is|sii", kwd_list, - &ioctxt.domain, - &state_file, - &ioctxt.vmconfig, - &progress, - &debug)){ + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|sii", kwd_list, + &ioctxt.domain, + &state_file, + &ioctxt.vmconfig, + &progress, + &debug) ) goto exit; - } + ioctxt.vmconfig_n = (ioctxt.vmconfig ? strlen(ioctxt.vmconfig) : 0); - if (progress) ioctxt.flags |= XCFLAGS_VERBOSE; - if (debug) ioctxt.flags |= XCFLAGS_DEBUG; - if(!state_file || state_file[0] == '\0') goto exit; + + if ( progress ) + ioctxt.flags |= XCFLAGS_VERBOSE; + if ( debug ) + ioctxt.flags |= XCFLAGS_DEBUG; + + if ( (state_file == NULL) || (state_file[0] == '\0') ) + goto exit; + rc = file_save(xc, &ioctxt, state_file); - if(rc){ + if ( rc != 0 ) + { PyErr_SetFromErrno(xc_error); goto exit; } - //xc_domain_destroy(xc->xc_handle, dom); + Py_INCREF(zero); val = zero; + exit: return val; } -static int file_restore(XcObject *xc, XcIOContext *ioctxt, char *state_file){ +static int file_restore(XcObject *xc, XcIOContext *ioctxt, char *state_file) +{ int rc = -1; ioctxt->io = gzip_stream_fopen(state_file, "rb"); - if (!ioctxt->io) { + if ( ioctxt->io == NULL ) + { xcio_perror(ioctxt, "Could not open file for reading"); - goto exit; + return rc; } rc = xc_linux_restore(xc->xc_handle, ioctxt); - exit: - if(ioctxt->io) IOStream_close(ioctxt->io); + + IOStream_close(ioctxt->io); + return rc; } @@ -285,33 +304,38 @@ static PyObject *pyxc_linux_restore(PyObject *self, XcObject *xc = (XcObject *)self; char *state_file; int progress = 1, debug = 0; - u32 dom; PyObject *val = NULL; XcIOContext ioctxt = { .info = iostdout, .err = iostderr }; int rc =-1; static char *kwd_list[] = { "state_file", "progress", "debug", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "is|ii", kwd_list, - &ioctxt.domain, - &state_file, - &progress, - &debug)){ + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|ii", kwd_list, + &ioctxt.domain, + &state_file, + &progress, + &debug) ) + goto exit; + + if ( progress ) + ioctxt.flags |= XCFLAGS_VERBOSE; + if ( debug ) + ioctxt.flags |= XCFLAGS_DEBUG; + + if ( (state_file == NULL) || (state_file[0] == '\0') ) goto exit; - } - if (progress) ioctxt.flags |= XCFLAGS_VERBOSE; - if (debug) ioctxt.flags |= XCFLAGS_DEBUG; - if(!state_file || state_file[0] == '\0') goto exit; rc = file_restore(xc, &ioctxt, state_file); - if(rc){ + if ( rc != 0 ) + { PyErr_SetFromErrno(xc_error); goto exit; } + val = Py_BuildValue("{s:i,s:s}", "dom", ioctxt.domain, "vmconfig", ioctxt.vmconfig); - //? free(ioctxt.vmconfig); + exit: return val; } diff --git a/tools/xentrace/Makefile b/tools/xentrace/Makefile index fb90e2c125..9590b5cffb 100644 --- a/tools/xentrace/Makefile +++ b/tools/xentrace/Makefile @@ -3,7 +3,7 @@ XEN_ROOT=../.. include $(XEN_ROOT)/tools/Make.defs CC = gcc -CFLAGS = -Wall -O3 -Werror +CFLAGS = -Wall -Werror -O3 CFLAGS += -I $(XEN_HYPERVISOR_IFS) CFLAGS += -I $(XEN_LINUX_INCLUDE) @@ -34,4 +34,4 @@ clean: $(RM) *.a *.so *.o *.rpm $(BIN) %: %.c $(HDRS) Makefile - $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc + $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -L$(XEN_LIBXUTIL) -lxc -lxutil